<template>
  <div>
    {{num1}}------{{num2}}
    两个数的和{{addNum}}
    <div><button @click="add">add</button></div>
  </div>
</template>

<script>
import { defineComponent, computed, ref } from 'vue'
export default defineComponent({
  name: 'Home',
  components: {

  },
  setup () {
    let num1 = ref(10)
    let num2 = ref(20)
    // 计算属性
    let addNum = computed(() => {
      // 逻辑处理
      // 必须返回一个值
      return num1.value + num2.value
    })
    let add = () => {
      num1.value++
      num2.value++
    }
    return {
      num1, num2, addNum, add
    }
  }
})
</script>

<style lang="scss" scoped>
</style>